package com.group3.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.SimpleDateFormat;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PunchRecord {
    private Integer punchId;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date punchDate;

    @JsonFormat(pattern = "HH:mm:ss")
    private Date punchTime;

    public void setPunchTime(Date punchTime){
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        this.punchTime = punchTime;
        try {
            this.punchDate = df.parse(df.format(punchTime));
        }catch (Exception e){
            return;
        }
    }

    private String studentId;

    private String studentName;

    private String equipment;
}
